package com.sac.approval.vo;

import com.sac.approval.domain.AttachmentDO;
import com.sac.approval.enums.ApprovalRoleEnum;
import com.sac.approval.enums.ApprovalStatusEnum;
import com.sac.common.utils.DateUtils;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 
 * @author xiaodong
 * @email liu.xiaodong@hp.com
 * @date 2018-09-18 15:41:04
 */
@Data
public class ApprovalVO implements Serializable {
	private static final long serialVersionUID = 1L;
	
	//主键
	private String appId;
	//标题
	private String title;
	//内容
	private String content;
	//文本类型：0  plain 1 html 2 mhtml
	private String contType;
	//编码
	private String charSet;
	//保密类型: 0-常规，1-机密，2-最高机密
	private String secretType;
	//0-常规；1-紧急
	private String urgentType;
	//0- 1-全部
	private String notifyType;
	//审批状态：处理中...审批完成
	private Integer status;

	private String isDelete;
	//创建人
	private String createUser;
	//创建时间
	private Date createTime;

	private String createUserNm;

	private String createUserJob;

	private String completeNum;

	private List<AttachmentDO> attachmentList;

	private String statusName;

	private String createTimeString;

    private String urgentTypeString;

	private String pendingApprover;

	public String getStatusName() {
		return ApprovalStatusEnum.getStatusEnumByValue(this.status).getName();
	}

	public String getCreateTimeString() {
		return DateUtils.format(this.createTime,"MM-dd hh:mm");
	}

    public String getUrgentTypeString() {
		String r = "General";
		if("Y".equalsIgnoreCase(this.urgentType))
			r = "Urgent";
		else if("N".equalsIgnoreCase(this.urgentType))
			r = "General";
		return r;
	}

	//主键
	private String appLineId;
	//序号
	private Integer seq;
	//收件人邮箱地址
	private String receiverMail;
	//收件人id
	private String receiverEpid;
	//邮件发送状态
	private String mailDeliveryStatus;
	//处理类型
	private Integer handleType;
	//收件时间
	private Date receiptTime;
	//预览时间
	private Date preReadTime;
	//阅读时间
	private Date readTime;
	//处理时间
	private Date handleTime;
	//备注
	private String remark;

	private String arbPmtYn;//特批权限

	private String txtMdfyPmtYn;//正文修改权限

	private String pathMdfyPmtYn;//路径修改权限

	private String receiverName;

    private String handleTypeName;

    private String receiptTimeString;

    private String readTimeString;

    private String handleTimeString;

	private String category;

    public String getHandleTypeName() {
        return ApprovalRoleEnum.getRoleEnumByValue(this.handleType).getName();
    }

    public String getReceiptTimeString() {
		return DateUtils.format(this.receiptTime,"MM-dd hh:mm");
	}

	public String getReadTimeString() {
		return DateUtils.format(this.readTime,"MM-dd hh:mm");
	}

	public String getHandleTimeString() {
		return DateUtils.format(this.handleTime,"MM-dd hh:mm");
	}
}
